package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : 诊断预警类型
 * @Date : 2022/12/5 13:41
 * @Modified by : zjf
 */
public enum WarnType implements EnumMethod{

    //正常
    NORMAL(0,"正常"),
    //过高
    TOO_HIGH(1, "过高"),
    //过低
    TOO_LOW(2, "过低"),
    ;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    WarnType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static String getDescFromCode(int code){
        for(WarnType type: WarnType.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }
}
